package Task21;

import java.util.Scanner;

/**
 * 牛客网洗牌
 */
public class Main2 {
    public static void playCard(int[] oldCard,int n, int k){
        if(oldCard == null){
            return;
        }
        //存放洗牌后的数组

        //洗牌K次
        for(int i = 0; i < k; i++){
            //存放洗牌后的数组
            int[] newCards = new int[oldCard.length];
            for(int j = 0;j < n; j++){
                newCards[2*j] = oldCard[j];
                newCards[2*j + 1] = oldCard[j+n];
            }
            oldCard = newCards;
        }
        for (int i = 0; i < oldCard.length - 1; i++) {
            System.out.print(oldCard[i] + " ");
        }
        System.out.println(oldCard[oldCard.length - 1]);
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //有几组牌
        int group = scanner.nextInt();

        for (int i = 0; i < group; i++) {
            //2*number张牌
            int number = scanner.nextInt();
            //洗多少次
            int k = scanner.nextInt();
            int[] oldCard = new int[2*number];
            for (int j = 0; j < oldCard.length; j++) {
                oldCard[j] = scanner.nextInt();
            }
            playCard(oldCard,number,k);
        }
    }
}
